#!/bin/bash
#run the daemon, rewrites arguments, adds its pids to the pids file

MP="`dirname \"$0\"`"  
NM="`basename \"$1\"`"
IP="${MP}/inputPipes/$NM"
MP+="/../bin/"
mkdir "$1"
mkfifo "$IP"
while [ 1 -le 2 ] ; do cat "$IP" | while read line ; do echo $line ; done ; done    | java -Djava.security.manager -Djava.security.policy="${MP}../policy-file" -cp "$MP" daemon.LongcatDaemon $1 $2 $3 $4  &
echo $! >> "$MP../test/pids"

